package com.venus.common.utils;

import java.util.List;

public class HighChartsUtil {

	
	public static String getPieChartJson(List<Object[]> lstDatas, String title){
		StringBuffer sb = new StringBuffer(128);
		sb.append("{");
		sb.append("\"title\":\""+title+"\",");
		sb.append("\"data\":[");
		for(int i=0;i<lstDatas.size();i++) {
			Object[] objs = lstDatas.get(i);
			sb.append("{");
			sb.append("\"name\":");
			sb.append("\""+objs[1]+"\"");
			sb.append(",\"y\":");
			sb.append(objs[2]);
			sb.append(",\"id\":");
			sb.append(objs[0]);
			sb.append("}");
			if(i<lstDatas.size()-1){
				sb.append(",");
			}
		}
		sb.append("]");
		sb.append("}");
		return sb.toString();
	}
}
